﻿<ResourceDictionary xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
                    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
                    xmlns:l="clr-namespace:Sobiens.WPF.Controls.UserControls">

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type l:ImageView},ResourceId=ImageView}"
         TargetType="{x:Type ListView}" BasedOn="{StaticResource {x:Type ListBox}}">
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="BorderThickness" Value="0.5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Name="bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                  Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}">
                        <ScrollViewer Margin="{TemplateBinding Padding}">
                            <WrapPanel ItemWidth="150" IsItemsHost="True" MinWidth="100"
                         Width="{Binding ActualWidth,RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}">
                            </WrapPanel>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type l:ImageView},ResourceId=ImageViewItem}"
         TargetType='{x:Type ListViewItem}' BasedOn='{StaticResource {x:Type ListBoxItem}}'>
        <Setter Property='Padding' Value='3'/>
        <Setter Property='Margin' Value='5'/>
        <Setter Property='HorizontalContentAlignment' Value='Center'/>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid>
                        <Border Background="White">
                            <Image Margin="3" Source="{Binding ImagePath}"/>
                        </Border>
                        <Label Margin="3" Content="{Binding Title}" FontWeight="Bold" Foreground="DarkBlue" />
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
